package com.example.demo.Mapper;

import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.demo.Entity.Comment;
import com.example.demo.Entity.Note;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
    @Select("select note_id from comment where comm_id like #{commId}")
    Integer findByCommId(Integer commId);

    @Select("select note_id,count(*) as num from comment Group By note_id order by num desc")
    List<JSONObject> findAllComment();
}
